// Problem 4: Largest palindrome product
// A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
// Find the largest palindrome made from the product of two 3-digit numbers.

package main

import (
	"fmt"
)

func p004() int {
	for a := 9; a > 0; a-- {
		for b := 9; b >= 0; b-- {
			for c := 9; c >= 0; c-- {
				p := a*100001 + b*10010 + c*1100
				for x := 100; x <= 999; x++ {
					if p%x == 0 && p/x <= 999 {
						fmt.Println("Problem 004:", p)
						return p
					}
				}
			}
		}
	}
	return -1
}
